#include "cpu/exec/template-start.h"

#define instr pop

make_helper(concat(pop_r_, SUFFIX)) {
    int reg = ops_decoded.opcode & 0x7;   
    uint32_t val = MEM_R(reg_l(R_ESP));  
    reg_l(R_ESP) += 4;
    REG(reg) = val;
    print_asm("pop %%%s", regsl[reg]);
    return 1;
}

/* pop rm (0x8F /0) */
make_helper(concat(pop_rm_, SUFFIX)) {
    int len = concat(decode_rm_, SUFFIX)(eip + 1);
    uint32_t val = MEM_R(reg_l(R_ESP));  
    reg_l(R_ESP) += 4;
    OPERAND_W(op_dest, val);
    print_asm("pop %s", op_dest->str);
    return len + 1;
}

#include "cpu/exec/template-end.h"
